package com.example.shoppingmall.service;

import com.example.shoppingmall.dao.AccountMapper;
import com.example.shoppingmall.pojo.AccType;
import com.example.shoppingmall.pojo.Account;
import com.example.shoppingmall.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountService {

    @Autowired
    AccountMapper accountMapper;

    //多条件查询+分页
    public List<Account> getAccList(String userPhone, Integer acc_typeId, Integer pageNo, Integer pageNum){
        return accountMapper.getAccList(userPhone, acc_typeId, pageNo, pageNum);
    }

    //查询总条数
    public int total(String userPhone,Integer acc_typeId){
        return accountMapper.total(userPhone, acc_typeId);
    }


    //新增(消费、提款)
    public int retAdd(Account account){
        return accountMapper.retAdd(account);
    }

    //新增(退款)
    public int retAddto(Account account){
        return accountMapper.retAddto(account);
    }

    //修改资金
    public int userUpdate(User user){
        return accountMapper.userUpdate(user);
    }

    //修改资金(退款)
    public int userUpdateto(User user){
        return accountMapper.userUpdateto(user);
    }

    //查询
    public User user1(String username){
        return accountMapper.user1(username);
    }

    public User user2(){
        return accountMapper.user2();
    }
    //acc_type类型查询
    public List<AccType> getAccTy(){
        return accountMapper.getAccTy();
    }

}
